2 #ifndef FRAMELIB_ERRORS_H 3 #define FRAMELIB_ERRORS_H 65 : mSource(source), mReporter(reporter), mError(error), mItems(items), mNumItems(numItems) {}
71 void getErrorText(std::string& text)
const;
83 unsigned long mNumItems;
98 const static int sCharArraySize = 8192;
99 const static int sReportArraySize = 1024;
147 ErrorList() : mReportsSize(0), mItemsSize(0), mFull(false) {}
155 size_t size()
const {
return mReportsSize; }
164 bool addItem(
const char *str)
166 char *ptr = mItems + mItemsSize;
167 size_t size = + strlen(str) + 1;
169 if (mItemsSize + size < sCharArraySize)
179 bool addItem(
long number)
182 sprintf(charArray,
"%ld", number);
183 return addItem(charArray);
186 bool addItem(
double number)
189 sprintf(charArray,
"%lf", number);
190 return addItem(charArray);
199 bool addItems(T first)
201 return addItem(first);
204 template<
typename T,
typename... Args>
205 bool addItems(T first, Args... args)
208 return addItems(args...);
212 template<
typename... Args>
215 char *ptr = mItems + mItemsSize;
217 if (!mFull && (mReportsSize < sReportArraySize) && addItems(args...))
219 mReports[mReportsSize] =
ErrorReport(source, reporter, error, ptr,
sizeof...(args));
229 char mItems[sCharArraySize];
241 template<
typename... Args>
244 mReports->add(source, reporter, error, args...);
246 if (mNotifier && !mNotified)
261 std::unique_ptr<ErrorList> mReports;
ErrorReport()
Definition: FrameLib_Errors.h:69
std::unique_ptr< ErrorList > getErrors()
Definition: FrameLib_Errors.cpp:25
ConstIterator end() const
Definition: FrameLib_Errors.h:158
Definition: FrameLib_Errors.h:22
a spinlock that can be locked, attempted or acquired.
Definition: FrameLib_Threading.h:84
a virtual struct allowing for extensible communication to/from the host environment.
Definition: FrameLib_Types.h:69
ConstIterator begin() const
Definition: FrameLib_Errors.h:157
a report for a single error.
Definition: FrameLib_Errors.h:60
a class used to report errors to the host environment.
Definition: FrameLib_Errors.h:34
Definition: FrameLib_Errors.h:22
ErrorSource getSource() const
Definition: FrameLib_Errors.h:72
Definition: FrameLib_Errors.h:22
void reportError(ErrorSource source, FrameLib_Proxy *reporter, const char *error, Args... args)
Definition: FrameLib_Errors.h:242
bool isFull() const
Definition: FrameLib_Errors.h:160
a list of ErrorReport objects.
Definition: FrameLib_Errors.h:94
Definition: FrameLib_Errors.h:22
const ErrorReport operator[](size_t idx) const
Definition: FrameLib_Errors.h:154
size_t size() const
Definition: FrameLib_Errors.h:155
FL_SP operator*(const FL_SP &a, const FL_SP &b)
Definition: FrameLib_FixedPoint.cpp:126
FrameLib_Proxy * getReporter() const
Definition: FrameLib_Errors.h:73
an iterator for reports in the list (with an underlying const ErrorReport type).
Definition: FrameLib_Errors.h:113
a virtual struct used to supply a method for notifying the host of errors.
Definition: FrameLib_Errors.h:47
ErrorList()
Definition: FrameLib_Errors.h:147
ErrorSource
Definition: FrameLib_Errors.h:22
FrameLib_ErrorReporter(HostNotifier *notifier)
Definition: FrameLib_Errors.h:237